//
//  UIBarButtonItem+Extension.m
//  AffectionBee
//
//  Created by 李通 on 16/8/18.
//  Copyright © 2016年 chivalrous. All rights reserved.
//

#import "UIBarButtonItem+Extension.h"
#import "ItemButton.h"

@implementation UIBarButtonItem (Extension)

- (UIBarButtonItem *)barButtonWithTitle:(NSString *)title titleColor:(UIColor *)color image:(UIImage *)image hightLightImage:(UIImage *)hightlightImage target:(id)target action:(SEL)action itemLoaction:(BOOL)location {
    
    ItemButton *button = [[ItemButton alloc]init];
    button.itemLocation = location;
    
    [button setTitle:title forState:UIControlStateNormal];
    [button setImage:image forState:UIControlStateNormal];
    [button setTitleColor:color forState:UIControlStateNormal];
    [button setImage:hightlightImage forState:UIControlStateHighlighted];
    [button addTarget:target action:action forControlEvents:UIControlEventTouchUpInside];
    button.frame = CGRectMake(0, 0, 45, 49);
    button.titleLabel.font = [UIFont systemFontOfSize:10];
    
    return [[UIBarButtonItem alloc]initWithCustomView:button];
}

@end
